package com.guchenghao.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @User 20675
 * @Author gch
 * @Date 2025/3/10 14:37
 * @Description <br />
 * <p>
 * <br />
 */
@Configuration
@ComponentScan("com.guchenghao.mapper")
public class MybatisPlusConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        // 创建MyBatisPlus拦截器链
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // 添加自动分页拦截器并指定数据库类型
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
